// dlg.txt

//MK Edit
//mark_quest_dest(zone,x,y,layer,quest);
//	code =
//		sf(,,2);
//		toggle_quest(19,10);
//		award_party_xp(MED_QUEST_XP);
//	break;

begintalkscript;

variables;

short this_town = 58;

begintalknode;
	tag = 1;
	condition = get_sdf(this_town,1) == 0;
	text1 = "You approach the ruined towers from the south. The upper tower is mostly intact, up a steep slope to the north. The lower tower, not far ahead, is mostly in ruins. The trenches of acidic slime are wider here. They have been eating at the walls and buildings for quite a few years. Soon, they will all be gone.";
	text2 = "From here, you can see the source of the slime rivers. This was a subterranean outpost for the Erudico. When they abandoned it, they carried all of their alchemical research down here in big vats. Then they dumped it into trenches and abandoned it.";
	text3 = "Here is what is odd. Normally, the stuff would eat away at the ground for a while, lose its magic, and become inert piles of toxic goop. Instead, the stuff has maintained its potency and even begun to expand. That doesn't usually happen.";
	text4 = "Something is feeding power into the slime. You can't be sure exactly what, but you note that the upper tower has a light glowing at the top.";
	code =
		sf(this_town,1,1);
		sf(this_town,2,1);
	break;
	
begintalknode;
	tag = 2;
	condition = get_sdf(this_town,2) == 0;
	text1 = "You approach the ruined towers from the north. The upper tower is mostly intact, ahead of you to the southeast. The lower tower, down a steep slope to the south, is in ruins. You get a good view of the trenches of acidic slime below, eating through stone and spreading into the caves beyond.";
	text2 = "You now know where the slime rivers to the south come from. This was a subterranean outpost for the Erudico. When they abandoned it, they carried all of their alchemical research to the region below in big vats. Then they dumped it into trenches and abandoned it.";
	text3 = "Here is what is odd. Normally, the stuff would eat away at the ground for a while, lose its magic, and become inert piles of toxic goop. Instead, the stuff has maintained its potency and even begun to expand. That doesn't usually happen.";
	text4 = "Something is feeding power into the slime. You can't be sure exactly what, but you note that the tower next to you has a light glowing at the top.";
	code =
		sf(this_town,1,1);
		sf(this_town,2,1);
	break;

begintalknode;
	tag = 3;
	condition = get_sdf(this_town,3) == 0 && gf(58,12) == 0;
	text1 = "You work your way through the ruins, keeping your distance from the glowing slime. The smell of it is powerful, an eye-watering mix of chemicals and rot. There is a lot of power in it. It's kind of amazing it's stayed this stable for this long.";
	text2 = "The crumbling southern tower is just to the northwest. Most of the upper floors of the tower are gone, but the thick walls of the base are intact. There may be an entrance ahead.";
	code =
		sf(this_town,3,1);
	break;

begintalknode;
	tag = 4;
	condition = get_sdf(this_town,4) == 0;
	text1 = "You enter the tower of the Erudico. It was abandoned at least a century ago, and everything in it seems frozen. No pests have invaded it. Dust hasn't even settled anywhere.";
	text2 = "Some power is protecting the tower, holding it for the eventual return of the Eruds. Perhaps it's related to the light glowing at the top.";
	code =
		sf(this_town,4,1);
	break;

begintalknode;
	tag = 5;
	condition = get_sdf(this_town,5) == 0;
	text1 = "__";
	code =
		sf(this_town,5,1);
	break;

begintalknode;
	tag = 6;
	condition = get_sdf(this_town,6) == 0;
	text1 = "__";
	code =
		sf(this_town,6,1);
	break;

begintalknode;
	tag = 7;
	condition = get_sdf(this_town,7) == 0;
	text1 = "__";
	code =
		sf(this_town,7,1);
	break;

begintalknode;
	tag = 8;
	condition = get_sdf(this_town,8) == 0;
	text1 = "__";
	code =
		sf(this_town,8,1);
	break;

begintalknode;
	tag = 9;
	condition = get_sdf(this_town,9) == 0;
	text1 = "__";
	code =
		sf(this_town,9,1);
	break;

begintalknode;
	tag = 10;
	condition = get_sdf(this_town,10) == 0;
	text1 = "__";
	code =
		sf(this_town,10,1);
	break;

begintalknode;
	tag = 11;
	condition = get_sdf(this_town,11) == 0;
	text1 = "__";
	code =
		sf(this_town,11,1);
	break;

begintalknode;
	tag = 12;
	condition = get_sdf(this_town,12) == 0;
	text1 = "__";
	code =
		sf(this_town,12,1);
	break;

// MIXED

begintalknode;
	tag = 13;
	condition = 1;
	text1 = "Gellassima screams. It convulses and collapses. Then all of the acidic slime infusing its body, held in check by magic and force of will, is allowed to dissolve the creature.";
	text2 = "You step back, allowing the beast to melt into a pool of goo. The ground under it hisses and smokes, but you manage to save your shoes.";
	text3 = "The gate to the north opens. You can now reach the upper tower from this direction.";
	
begintalknode;
	tag = 14;
	condition = 1;
	text1 = "The bones have been damaged too much to stay together. They fall apart. The spirit of Arthchimedes is released. It is a pitiful ghost, a wisp of magic and will. With a final scream, it falls to bits.";
	text2 = "With the master of the tower dead, the atmosphere is instantly different. Quieter. Less energy in the air.";
	text3 = "Perhaps now the slime below will be fed with less energy. Perhaps it will stop spreading now. Perhaps the Erudico will, one day, one time, clean up one of their messes themselves. You can only hope.";

begintalknode;
	tag = 15;
	condition = 1;
	text1 = "A freezing wind blows through the room! Everyone who hasn't found a source of warmth is overpowered by the cold.";

begintalknode;
	tag = 16;
	condition = 1;
	text1 = "Before the Erudico abandoned the tower, they stuffed this chest with a pile of notes they thought were worth saving. Mold and age have had their way with them. They are illegible.";
	text2 = "Under the mess, however, you find an intact, leather-bound book. It is called Erudico Sky Signs and, ironically for its location, has a variety of fascinating astronomical observations.";
	text3 = "You keep it. Some sage or researcher might be interested, perhaps even a Havenite.";
	code =
		if (gf(58,16) == 0) {
			sf(58,16,1);
			set_spec_item(32,1);
			}
			else {
				rs(2); rs(3);
				}
	break;
	
begintalknode;
	tag = 17;
	condition = 1;
	text1 = "__";

begintalknode;
	tag = 18;
	condition = 1;
	text1 = "__";

begintalknode;
	tag = 19;
	condition = 1;
	text1 = "__";

begintalknode;
	tag = 20;
	condition = 1;
	text1 = "__";

begintalknode;
	tag = 21;
	condition = 1;
	text1 = "__";

begintalknode;
	tag = 22;
	condition = 1;
	text1 = "__";

////

begintalknode;
	tag = 30;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Name";
	text1 = "You are in what is left of the southern tower. A square base, surrounded by crumbling walls. Above, you see stalactites wreathed in green mist.";
	text2 = "The tower has one resident: A huge drake. She is very old and entirely corrupted by the slime of the pit. Her skin oozes acid, and wisps of poisonous gas rise from her mouth. You can sense her intense power, and you can tell why she accepted the corruption. She is a ferocious beast.";
	text3 = "When you enter, she is staring at the closed gate to the north. Then she looks at you. _Stop, intrudersss. I am Gellassima, guardian of the portal. I was placed here to stop invaderssss. You will go._";
	text5 = "Gellassima stares at you unblinkingly. Trickles of acid run from her eyes, drip off her chin, and hiss when they hit the stone. She grins, showing twisted, rotting fangs.";
	text6 = "_My message is unchanged. I was placed to guard the portal. You will go._";
	action = INTRO;
	code =
		sf(58,14,1);
	break;
	
begintalknode;
	state = 10;
	nextstate = 11;
	condition = 1;
	question = "_Who placed you here?_";
	text1 = "_I went to Arthchimedes. He told me to draw from his power. I would be strong and unending. I would gain wealth. In return, I guard the tower._";

begintalknode;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "_Arthchimedes?_";
	text1 = "_The sentinel of the Erudico. The master. The guard of the tower._";
	text2 = "She looks up at the upper tower. It is still glowing at the top.";

begintalknode;
	state = 10;
	nextstate = 12;
	condition = 1;
	question = "_What happened to you?_";
	text1 = "_I absorbed the power here._";

begintalknode;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "_You mean the slime?_";
	text1 = "_Yes. It is a thousand Erudico experiments combined. So much raw power. I am a drake! I knew how to absorb it._";

begintalknode;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "_That slime is encroaching on the caves to the south._";
	text1 = "_Not my concern. If it was a problem, Arthchimedes would have addressed it._";

begintalknode;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "_I am a [P] of Haven. You will not interfere with my progress._";
	text1 = "The drake gets a faraway look. _Haven? [P]? These words have lost meaning to me. Gaining so much power has hurt my focus._";

begintalknode;
	state = 10;
	nextstate = 13;
	condition = 1;
	question = "_I want to pass to the northern tower._";
	text1 = "_I guard the gate. I will not open it until you have bested me. That is the deal I made with Arthchimedes._";
	text2 = "She spreads her wings and hisses at you, fouling the air of the hall. Again, you can sense how powerful she is. A truly challenging foe.";

begintalknode;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "_Never mind, then._";
	text1 = "_Leave me, intruder. You may go the way you came. I am just and patient. Do not bother me again._";
	action = END_TALK;
	
begintalknode;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "_I challenge you._";
	text1 = "_Then I will feed on living, thinking flesh! I will taste your brain! What a delightful gift, an unexpected surprise!_";
	action = END_TALK;
	code =
		set_attitude(5831,10);
	break;
		
begintalknode;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "_I'll be going now._";
	text1 = "_I am just and patient. I will allow your escape. Leave me, intruder. You may go the way you came. Do not bother me again._";
	action = END_TALK;

	
// Arthchimedes

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 40;
	condition = 1;
	question = "Name";
	text1 = "At last, on the top floor of the tower, you meet the Erudico master. Not a living person, of course. Any actual human would have died many years ago. Instead, it is a skeleton. The animated form of a dead Erudico. Alas, it still feels like it has all of its power.";
	text2 = "Its skull slowly swivels to look at you. _Intruder, you invade the tower of the Erudico. It is our claim. I am Arthchimedes, left to guard here. Are you of the Erudico?_";
	text5 = "Arthchimedes still stands in front of its rotting throne. You can still feel the thing's raw magical power. Your skin tingles. It says, _Still here. I ask again, are you of the Erudico?_";
	action = INTRO;
	code =
		sf(58,11,1);
		set_dialogue_pic(853); // skeleton
	break;

	
begintalknode;
	state = 40;
	nextstate = -1;
	condition = party_within_dist(41,29,7) == FALSE;
	question = "_I want to discuss this tower._";
	text1 = "_Not yet! Not while some of you are skulking around! All must approach and face me._";
	action = END_TALK;

begintalknode;
	state = 40;
	nextstate = -1;
	condition = party_within_dist(41,29,7);
	question = "_Who were you in life?_";
	text1 = "_I was Arthchimedes, master sage of the Erudico. When this tower was abandoned, I was close to death. I chose to exist in this form, guarding our secrets, until we returned._";

begintalknode;
	state = 40;
	nextstate = -1;
	condition = party_within_dist(41,29,7);
	question = "_Tell me about this tower._";
	text1 = "_Due to staffing issues, the Erudico temporarily had to abandon it. Don't fret. We will return in force soon. Now you must answer my question. Are you Erudico?_";

begintalknode;
	state = 40;
	nextstate = 41;
	condition = 1;
	question = "_Did you know that your slime is leaking out into the caves to the south?_";
	text1 = "_Not a concern. I use my power to keep the slime energized, feeding and growing. The Erudico will be able to learn from it when they return._";

begintalknode;
	state = 41;
	nextstate = 40;
	condition = 1;
	question = "_Is it really that valuable?_";
	text1 = "_It is so ripe, so aged, so infused with chaotic power. I'm sure we can do something useful with it!_";
	text2 = "_But back to business. Are you Erudico?_";

begintalknode;
	state = 41;
	nextstate = 40;
	condition = 1;
	question = "_I'd like for you to get rid of it._";
	text1 = "_Your request has been heard._ A long pause. _Request denied!_";
	text2 = "_But back to business. Are you Erudico?_";

begintalknode;
	state = 40;
	nextstate = 43;
	condition = party_within_dist(41,29,7);
	question = "_I am Erudico._ Lie.";
	text1 = "_No! You lie! You think I can't tell, half-Ro? I see so much more clearly than I did in life._";
	text2 = "_You are an intruder here. The Erudico are peaceful when we can be. You may leave alive, but only if you go now._";

begintalknode;
	state = 40;
	nextstate = 43;
	condition = party_within_dist(41,29,7);
	question = "_I am not Erudico._";
	text1 = "_I can see that. I can see you are a hunter. An outsider. You are ... half Ro? Yes. Half. But no more. I see so much more clearly than I did in life._";
	text2 = "_You are an intruder here. The Erudico are peaceful when we can be. You may leave alive, but only if you go now._";

begintalknode;
	state = 43;
	nextstate = -1;
	condition = 1;
	question = "_I'll go then._";
	text1 = "_See that you do, or face destruction!_";
	action = END_TALK;

begintalknode;
	state = 43;
	nextstate = -1;
	condition = 1;
	question = "_I'm not going anywhere. This mess needs to be cleaned up._";
	text1 = "_You received a fair warning, half-Ro! Now you will be expelled._";
	text2 = "Arthchimedes raises its arms. The gate behind you slams shut. The air immediately grows cold. Then freezing. You start to shudder. It is painfully cold, though it doesn't affect the skeleton, of course.";
	text3 = "One of the torches suddenly bursts into flame. Odd. Maybe it's some sort of automatic safety system for when the room gets too cold.";
	action = END_TALK;
	code =
		sf(58,24,0);
		set_attitude(5868,10);
		set_terrain(1,45,29,607);
		
		if (difficulty() > 0) {
			spawn_creature(5869);
			set_name(5869,"Voracious Construct");
			set_level(5869,18);
			change_max_health(5869,250);
			set_boss_level(5869,1);
			set_percent_adjust(5869,0,95);
			set_percent_adjust(5869,1,95);
			}
	break;
	

	
//

begintalknode;
	tag = 70;
	state = -1;
	nextstate = 70;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";


//

begintalknode;
	tag = 100;
	state = -1;
	nextstate = 100;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 100;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

//

begintalknode;
	tag = 130;
	state = -1;
	nextstate = 130;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 130;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

//

begintalknode;
	tag = 160;
	state = -1;
	nextstate = 160;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 160;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";
		
//

begintalknode;
	tag = 190;
	state = -1;
	nextstate = 190;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 190;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";
				